<!-- Wrapper -->
<div id="location_popup">

<!-- Types -->
<div id="type_list">
 <% @location.locations_types.each{ |d| %>
 <li>
 <%= d.name %>
 <% unless d.type.nil? %>
	 <% unless d.type.wikipedia_url.nil? or d.type.wikipedia_url.strip == "" %>
		<a href="<%= d.type.wikipedia_url %>" target="_blank"><img class="type_icon" src="/wikipedia_icon.png"></a>
	 <% end %>
	 <% unless d.type.usda_symbol.nil? or d.type.usda_symbol.strip == "" %>
		<a href="http://plants.usda.gov/java/profile?symbol=<%= d.type.usda_symbol %>" target="_blank"><img class="type_icon" src="/usda_icon.png"></a>
	 <% end %>
 <% end %>
 </li>
 <% } %>
</div>

<!-- Description wrapper -->
<div id="description">

<!-- Quality -->
<% unless location.quality_rating.nil? %>
	<% ratings = "true" %>
 <label>Quality</label> "<%= Location::Ratings[location.quality_rating] %>"
<% end %>

<!-- Yield -->
<% unless location.yield_rating.nil? %>
	<% ratings = "true" %>
 <label>Yield</label> "<%= Location::Ratings[location.yield_rating] %>"
<% end %>
<% unless ratings.nil? %>
	<br/>
<% end %>

<!-- Season -->
<!-- (use ? to denote nil, brown out of season, green in season) -->
<% unless location.no_season or (location.season_start.nil? and location.season_stop.nil?) %>
 <label>Season</label>&nbsp;  <!-- to account for " of ratings -->
 <% current = Date.today.month.to_i - 1 
    season_class = "out_season"
    season_class = "in_season" if (current == location.season_start) or (current == location.season_stop)
    season_class = "in_season" if (!location.season_start.nil? and !location.season_stop.nil? and 
                                  current >= location.season_start and current <= location.season_stop)
    pretty_stop = location.season_stop.nil? ? "?" : Location::Months[location.season_stop]
    pretty_start = location.season_start.nil? ? "?" : Location::Months[location.season_start]
  %>
  <span class="<%= season_class %>">
  <% unless pretty_start == pretty_stop %>
  	<%= pretty_start %> - <%= pretty_stop %>
  <% else %>
  	<%= pretty_start %>
	<% end %>
  </span><br/>
<% end %>
 
<!-- Text Description -->
<!-- (keep <p> markup even if empty) -->
<p>
<% unless location.description.nil? %>
 <%= raw location.description.gsub("\n","<br>") %>
<% end %>

<% unless location.access.nil? %>
<span style="font-style: italic; color: #a9a9a9;"><br><br><%= Location::AccessStatements[location.access] %></span>
<% end %>
</p>

</div>  <!-- Description wrapper -->

<!-- Controls & Author -->
<!-- (using table instead of display: table-cell for compatibility with IE <= 7) -->
<table id="footer">
	<tr>
 		<td id="controls">
 		<a href="/locations/<%= location.id %>">permalink</a><a href="/locations/<%= location.id %>/edit">edit</a>
 		<% if admin_signed_in? %>
  		<%= link_to 'delete', location, method: :delete, data: { confirm: 'Are you sure?' } %>
 		<% end %>
 		</td>
  	<td id="added_by">by <i><%= (location.author.nil? or (location.author.strip.length == 0)) ? "Anonymous" : location.author %></i></td>
 	</tr>
</table>

</div>  <!-- Wrapper -->
